refactor: Refactor remaining controllers to remove duplicate messenger types#42853
Conversation
Builds ready [23844f4]
⚡ Performance Benchmarks (Total: 🟢 11 pass · 🟡 13 warn · 🔴 0 fail)
Bundle size diffs [🚀 Bundle size reduced!]
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 23844f4. Configure here.
mcmire
left a comment
There was a problem hiding this comment.
Looks like there are conflicts, but this otherwise looks good.
| | SnapControllerGetPermittedSnapsAction | ||
| | SnapControllerInstallSnapsAction; | ||
|
|
||
| // TODO: Ideally we remove this type, but we request more permissions than |
23844f4 to
ded356b
Compare
|
Builds ready [06d6126]
⚡ Performance Benchmarks (Total: 🟢 22 pass · 🟡 2 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|




Description
This refactors all remaining messenger client init files to do the following:
https://consensyssoftware.atlassian.net/browse/WPC-950
Changelog
CHANGELOG entry:
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Large but mechanical typing/import refactor across init and messenger factories; runtime delegate behavior is intended unchanged, with compile-time risk if delegated actions diverge from package messenger definitions.
Overview
This PR finishes the messenger-client-init cleanup by sourcing controller messenger types from their owning packages (or local controllers where applicable) instead of duplicating
ReturnType<typeof get*Messenger>aliases undermessengers/.Init modules (
*-init.ts/ tests) now import*ControllerMessengernext to the controller from@metamask/*(e.g. assets, accounts, keyring, multichain). Messenger factories useMessengerActions/MessengerEventsonRootMessenger, construct messengers with the non-genericnew Messenger({ namespace, parent }), and return the package-defined messenger type while keeping existingdelegatewiring. Barrel files drop re-exports of controller messenger types and keep only init messenger types where still defined locally.Notable renames/imports:
CurrencyRateMessengerreplaces the localCurrencyRateControllerMessengername;InstitutionalSnapControllerMessengeris imported from the extension controller module. A few spots still use extension-specific messenger shapes (e.g.PermissionController,PerpsController) with TODOs where the package type is narrower than runtime delegation.Reviewed by Cursor Bugbot for commit 06d6126. Bugbot is set up for automated code reviews on this repo. Configure here.